<?php $this->load->view('admin/head.php'); ?>
<!--/sidebar-->
<div class="main-wrap">

    <div class="crumb-wrap">
        <div class="crumb-list"><i class="icon-font"></i><a href="<?php echo site_url('index/index')?>">首页</a><span class="crumb-step">&gt;</span>管理员密码修改</div>
    </div>
    <div class="result-wrap">
        <div class="result-content">
                <table class="insert-tab" width="100%">
                    <tbody>
                    <tr>
                        <th><i class="require-red">*</i>原密码：</th>
                        <td>
                            <input class="common-text required" id="pwd" name="pwd" size="50" value="" type="password">
                        </td>
                    </tr>
                    <tr>
                        <th><i class="require-red">*</i>新密码：</th>
                        <td>
                            <input class="common-text required" id="new_pwd" name="new_pwd" size="50" value="" type="password">
                        </td>
                    </tr>
                    <tr>
                        <th><i class="require-red">*</i>确认密码：</th>
                        <td>
                            <input class="common-text required" id="password" name="password" size="50" value="" type="password">
                        </td>
                    </tr>

                    <tr>
                        <th></th>
                        <td>
                            <input class="btn btn-primary btn6 mr10" value="提交" type="button" onclick="update_passwd();">
                            <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button">
                        </td>
                    </tr>
                    </tbody></table>
        </div>
    </div>

</div>
<script type="text/javascript">
    function update_passwd(){
        $.ajax({
            type: "POST",
            url: "<?php echo site_url('admin/index/update_passwd/')?>",
            data: 'pwd='+ $('#pwd').val() + '&new_pwd='+ $('#new_pwd').val() + '&password='+ $('#password').val(),
            success: function(data){
                var dataObj=eval("("+data+")");
                if(dataObj.num==1){

                    var mes=confirm("修改成功！ 是否跳转到后台首页");
                    if(mes==true) {
                        window.location.href = "<?php echo site_url('admin/index/index')?>";
                    }
                }else{
                    alert(dataObj.error);
                    // window.location.reload();
                }

            }
        });
    }

</script>
<!--/main-->
</div>
</body>
</html>